<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\Auth;
use App\Models\Order;
class HomeController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth');
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //获取待付款
        $dnum = Order::where('status', 1)->where('user_id', Auth::user()->id)->count();
        //获取待审核
        $snum = Order::where('status', 0)->where('user_id', Auth::user()->id)->count();
        //获取待收款
        $knum = Order::where('status', 0)->where('user_id', Auth::user()->id)->count();
        return view('home', compact('dnum', 'snum', 'knum'));
    }
}
